package com.capgemini.simpleappblanche.utils.mock;

import java.util.ArrayList;
import java.util.List;

import com.capgemini.simpleappblanche.domain.Agency;


public class AgencyMockEntities {

	
	public static List<Agency> getAgencies(){
		final List<Agency> agencies= new ArrayList<Agency>();
		
		Agency agency;
		
		agency = new Agency();
		agency.setId(new Long(1));
		agency.setName("LILLE");
		agency.setActive(Boolean.TRUE);
		agencies.add(agency);
		
		agency = new Agency();
		agency.setId(new Long(2));
		agency.setName("PARIs");
		agency.setActive(Boolean.TRUE);
		agencies.add(agency);
		
		agency = new Agency();
		agency.setId(new Long(3));
		agency.setName("LYON");
		agency.setActive(Boolean.TRUE);
		agencies.add(agency);

		agency = new Agency();
		agency.setId(new Long(4));
		agency.setName("MARSEILLE");
		agency.setActive(Boolean.FALSE);
		agencies.add(agency);
		
		return agencies;
	}

	public static List<Agency> getActiveAgencies(){
		final List<Agency> agenciesTmp = getAgencies();
		
		final List<Agency> agencies = new ArrayList<Agency>();
		
		for(Agency agency : agenciesTmp){
			if(agency.getActive()){
				agencies.add(agency);
			}
		}
		return agencies;
	}
	
	public static List<Agency> getActiveAgencies(List<Long> ids){
		final List<Agency> agenciesTmp = getAgencies();
		
		final List<Agency> agencies = new ArrayList<Agency>();
		
		for(Agency agency : agenciesTmp){
			if(agency.getActive() && ids.contains(agency.getId())){
				agencies.add(agency);
			}
		}
		return agencies;
	}
}
